from typing import Any, Dict

class ContentForgeBaseException(Exception):
    """基础异常类"""
    def __init__(self, message: str, details: Dict[str, Any] = None):
        self.message = message
        self.details = details or {}
        super().__init__(self.message)

class ArticleNotFoundException(ContentForgeBaseException):
    """文章未找到异常"""
    def __init__(self, article_id: str):
        super().__init__(
            f"未找到ID为 {article_id} 的文章", 
            {"article_id": article_id}
        )

class ProcessingException(ContentForgeBaseException):
    """文章处理异常"""
    def __init__(self, message: str, article_id: str = None):
        details = {"article_id": article_id} if article_id else {}
        super().__init__(message, details)

class AIProcessingError(ProcessingException):
    """AI处理错误"""
    def __init__(self, message: str, article_id: str = None, error_code: str = None):
        details = {
            "article_id": article_id,
            "error_code": error_code
        }
        super().__init__(message, details) 